Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App watcher - Build extensions #4346

Merged
merged 36 commits into from
Nov 4, 2024
Merged

App watcher - Build extensions #4346

merged 36 commits into from
Nov 4, 2024

Conversation

isaacroldan
Copy link
Contributor

@isaacroldan isaacroldan commented Aug 19, 2024

WHY are these changes introduced?

App watcher now has the responsibility of building extensions when they change.

For extensions that use ESBuild, it handles that using using contexts.

Having a unified place for watching and building extensions during dev is very convenient, as the events from here can be used by the different processes running during dev:

  • Legacy partners draft update
  • New management api updates
  • Previewable extensions using the dev console
  • ...

WHAT is this pull request doing?

  • The App Watcher will now build extensions:
    • At start, build all extensions
    • On every change, rebuild the affected extensions.
  • Remove the UpdatedSource event type for the watcher.
  • For extensions using ESBuild: use esbuild contexts to handle incremental builds (which means: faster builds)
  • All build artifacts are generated in the local .shopify directory by default.
  • Update the new dev flow to use this new feature.

How to test your changes?

Having an app with different extensions (specially ui-extensions and functions):

  • Run pnpm shopify demo watcher --path <path_to_app>
  • Open the .shopify/bundle directory, you should see all the built extensions.
  • Make a change in an extension with source code, it should update the built artifact.

Alternative: Having an org in app-management, run dev with the new API.

Post-release steps

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

@isaacroldan isaacroldan changed the title App watcher build App watcher - Build extensions Aug 19, 2024
Copy link
Contributor

We detected some changes at either packages/*/src or packages/cli-kit/assets/cli-ruby/** and there are no updates in the .changeset.
If the changes are user-facing, run "pnpm changeset add" to track your changes and include them in the next release CHANGELOG.

Copy link
Contributor

github-actions bot commented Aug 19, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
72.5% (+0.22% 🔼)
8461/11671
🟡 Branches
68.86% (+0.15% 🔼)
4108/5966
🟡 Functions
71.9% (+0.14% 🔼)
2224/3093
🟡 Lines
72.83% (+0.25% 🔼)
8000/10984
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢
... / app-event-watcher-handler.ts
88.37% 75% 86.67% 88.24%
🟢
... / app-watcher-esbuild.ts
90.32% 100% 84.62% 93.1%
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / app-diffing.ts
100%
85.71% (-14.29% 🔻)
100% 100%
🟡
... / app-event-watcher.ts
72.73% (-11.89% 🔻)
50% (-20% 🔻)
77.78% (-7.22% 🔻)
77.55% (-5.43% 🔻)
🟢
... / file-watcher.ts
82.19% (+2.19% 🔼)
71.43% (-2.76% 🔻)
76.47% (-0.45% 🔻)
84.85% (+2.71% 🔼)

Test suite run success

1922 tests passing in 874 suites.

Report generated by 🧪jest coverage report action from 7273aff

Copy link
Contributor

This PR seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action.
→ If there's no activity within a week, then a bot will automatically close this.
Thanks for helping to improve Shopify's dev tooling and experience.

@isaacroldan isaacroldan requested a review from a team as a code owner October 21, 2024 09:10
Copy link
Contributor

We detected some changes at packages/*/src and there are no updates in the .changeset.
If the changes are user-facing, run "pnpm changeset add" to track your changes and include them in the next release CHANGELOG.

@isaacroldan
Copy link
Contributor Author

/snapit

Copy link
Contributor

🫰✨ Thanks @isaacroldan! Your snapshot has been published to npm.

Test the snapshot by intalling your package globally:

pnpm i -g @shopify/cli@0.0.0-snapshot-20241024163114

After installing, validate the version by running just shopify in your terminal
If the versions don't match, you might have multiple global instances installed.
Use which shopify to find out which one you are running and uninstall it.

Copy link
Contributor

@gonzaloriestra gonzaloriestra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working like a charm, and the code looks nice 👌

@isaacroldan isaacroldan added this pull request to the merge queue Nov 4, 2024
Merged via the queue into main with commit a5fcadc Nov 4, 2024
27 checks passed
@isaacroldan isaacroldan deleted the app-watcher-build branch November 4, 2024 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants